<#import "_master.ftl" as layout />

<@layout.masterTemplate
title="Modelli">

<script type="text/javascript" src="http://jzaefferer.github.com/jquery-validation/jquery.validate.js"></script>
<section id="model">
	<div class="page-header">
		<h1>
			Modelli
			<button class="btn" type="button" style="float:right" id="create-new">
				<i class=" icon-plus"></i>
				Crea nuovo modello
			</button>
		</h1>
	</div>

	<@layout.alert type="success" title="Bene!" message="Il nuovo modello è stato creato con successo." />  	
	<@layout.alert type="error" title="Oooopppps!" message="Qualcosa è andato storto." />

	<form class="bs-docs form-horizontal" style="display:none" id="form-new" method="post">
		<button type="button" class="close" title="chiudi">×</button>
		<legend>Crea nuovo modello</legend>
		<div class="control-group">
			<label class="control-label" for="nome">Nome</label>
			<div class="controls">
				<input type="text" id="nome" name="nome" class="required" placeholder="Nome" />
			</div>
		</div>
		<div class="control-group">
			<div class="controls">
				<button type="submit" class="btn btn-primary" id="submit-new">Crea</button>
			</div>
		</div>
	</form>

	
	<table class="table table-striped" id="list">
		<#if (modelli?size > 0)>
		<thead>
			<tr>
				<th>#</th>
				<th>Nome</th>
			</tr>
		</thead>
		<tbody>

			<#list modelli as modello>
			<tr>
				<td>${modello.id?string.computer}</td>
				<td>${modello.nome}</td>
			</tr>
			</#list>
		</tbody>
		<#else>
		<tbody>
			<tr>
				<td colspan="2">Nessun modello trovato</td>
			</tr>
		</tbody>
	</#if>
	</table>
</section>



</@layout.masterTemplate>